package com.soar.recruitment.common.bll;


import com.soar.framework.app.FrameworkConstants;
import com.soar.recruitment.common.app.SOARConstants;
import com.soar.recruitment.common.dal.event.LoginEvent;
import com.soar.recruitment.common.util.SPUtils;
import com.soar.recruitment.module.user.dal.bean.UserModel;
import org.greenrobot.eventbus.EventBus;

public class LoginManager {

    /**
     * 登录成功之后的数据处理
     */
    public static void loginSuccess(UserModel userModel) {
        SPUtils.put(SOARConstants.KEY_TOKEN, userModel.access_token);
        FrameworkConstants.PARAMS_TOKEN = userModel.access_token;
        EventBus.getDefault().post(new LoginEvent());
    }

    /**
     * 退出 - 清除数据
     */
    public static void loginOut() {
        SPUtils.remove(SOARConstants.KEY_TOKEN);
        FrameworkConstants.PARAMS_TOKEN = "";
        EventBus.getDefault().post(new LoginEvent());
    }

}
